var a = require("../../../api.js"), e = getApp(), t = require("../../../wxParse/wxParse.js");

Page({
    data: {
        award: {},
        id: ""
    },
    getAwardHandler: function(t) {
        var s = this;
        e.request({
            url: a.driver.receive,
            method: "post",
            data: {
                id: s.data.id
            },
            success: function(a) {
                1 == a.code ? wx.showModal({
                    title: "提示",
                    content: "领取成功",
                    icon: "none",
                    success: function() {
                        wx.navigateBack({
                            delta: 1
                        });
                    }
                }) : wx.showModal({
                    title: "提示",
                    content: "条件不足，无法领取",
                    icon: "none",
                    success: function() {
                        wx.navigateBack({
                            delta: 1
                        });
                    }
                });
            }
        });
    },
    onLoad: function(a) {
        console.log("奖励详情", a), this.setData({
            id: a.id
        }), a.uid && e.shareCouponsMessage(a.uid);
    },
    onReady: function() {},
    onShow: function() {
        var s = this;
        e.request({
            url: a.driver.details,
            method: "post",
            data: {
                id: s.data.id
            },
            success: function(a) {
                s.setData({
                    award: a.data
                }), t.wxParse("active", "html", a.data.remark, s, 5);
            }
        });
    }
});